<!-- 借支发放单 -->
<template>
	<view>
		<view class="p-3">
			<view class="bt-block">
				<bg-cell2 label="姓名" :value="obj.createUserName"></bg-cell2>
				<bg-cell2 label="身份证号" :value="obj.idCardNo"></bg-cell2>
				<bg-cell2 :border="false" label="手机号" :value="obj.phone"></bg-cell2>
			</view>
			<view class="bt-block mt-3">
				<bg-title class="ml-3 margin-top">
					<text class="font-14 font-normal">借支申请单</text>
				</bg-title>
				<bg-cell2 label="项目名称" :value="obj.projectName"></bg-cell2>
				<bg-cell2 label="借支金额" :value="obj.amount"></bg-cell2>
				<bg-cell2 label="卡号" :value="obj.bankCardNo"></bg-cell2>
				<bg-cell2 :border="false" label="开户行" :value="obj.bankName"></bg-cell2>
			</view>
			<view class="bt-block mt-3">
				<bg-title class="ml-3 margin-top">
					<text class="font-14 font-normal">本人确认签字</text>
				</bg-title>
				<view class="mx-3 my-4">
					<u--image :src="obj.signedImg" width="380rpx" height="154rpx"></u--image>
				</view>
			</view>
		</view>
		<view class="bt-footer" v-if="showBtn()">
			<bg-btn @click="saveData">发放</bg-btn>
		</view>
	</view>
</template>

<script>
	import {borrowDetail, immediatelySend} from "@/api/salary.js"
	export default {
		onLoad(options){
			this.id = options.bid
			this.show = options.show
			this.getData()
		},
		data() {
			return {
				show:false,
				id:'',
				obj:{}
			}
		},
		methods: {
			getData(){
				borrowDetail(this.id).then(res=>{
					this.obj = res.data
				})
			},
			//todo 发放接口
			saveData(){
				immediatelySend({id:this.id}).then(res=>{
					this.$modal.msg("发放成功")
					uni.$emit("refresh-borrow", true)
					this.$tab.navigateBackDelay()
				})
			},
			showBtn(){
				return this.show&&this.$auth.hasRoleOr(["project","fanance"])
			}
		}
	}
</script>

<style>

</style>
